<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath }"/>
<%@taglib  prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>低值资产管理系统</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1.0" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	<meta name="MobileOptimized" content="320">
	<!-- BEGIN GLOBAL MANDATORY STYLES -->          
	<link href="${ctx}/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
	<!-- END GLOBAL MANDATORY STYLES -->
	<!-- BEGIN THEME STYLES --> 
	<link href="${ctx}/assets/css/style-metronic.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/style-responsive.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/plugins.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/themes/light.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx}/assets/css/custom.css" rel="stylesheet" type="text/css"/>
	<link href="${ctx }/assets/plugins/jquery-file-upload/css/jquery.fileupload-ui.css" rel="stylesheet" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-daterangepicker/daterangepicker-bs3.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/bootstrap-datetimepicker/css/datetimepicker.css" />
	<link rel="stylesheet" type="text/css" href="${ctx}/assets/plugins/jquery-multi-select/css/multi-select.css" />
	<link href="${ctx }/css/custom.css" rel="stylesheet" type="text/css"/>

	<link href="${ctx}/frontend/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
   
   	<link href="${ctx}/frontend/assets/css/pages/portfolio.css" rel="stylesheet" type="text/css"/>

	<link href="${ctx}/frontend/assets/plugins/fancybox/source/jquery.fancybox.css" rel="stylesheet" />              
    <link rel="stylesheet" href="${ctx}/frontend/assets/plugins/revolution_slider/css/rs-style.css" media="screen">
    <link rel="stylesheet" href="${ctx}/frontend/assets/plugins/revolution_slider/rs-plugin/css/settings.css" media="screen"> 
    <link href="${ctx}/frontend/assets/plugins/bxslider/jquery.bxslider.css" rel="stylesheet" />       
	<!-- END THEME STYLES -->	
	<link rel="shortcut icon" href="favicon.ico" />
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed page-full-width">
	<!-- BEGIN HEADER -->   
	<%@include file="../include/header.jsp" %>
	<!-- END HEADER -->
	
	<!-- BEGIN CONTAINER -->
	<div class="page-container">
		<div class="page-content">
			
			<!-- END BEGIN STYLE CUSTOMIZER -->            
			<!-- BEGIN PAGE HEADER-->
			<div class="row">
				<div class="col-md-12">
					<!-- BEGIN PAGE TITLE & BREADCRUMB-->
					<h3 class="page-title">
						物资详情
					</h3>
					
					<!-- END PAGE TITLE & BREADCRUMB-->
				</div>
			</div>
			<!-- END PAGE HEADER-->
			<!-- BEGIN PAGE CONTENT-->          
			<div class="row">
				<div class="col-md-12">
					
					<!-- BEGIN SAMPLE TABLE PORTLET-->
					<div class="portlet box green">
						<div class="portlet-title">
							<div class="caption"><i class="fa fa-cogs"></i>物资详细信息</div>
							<div class="tools">
								<a href="javascript:;" class="collapse"></a>
							</div>
						</div>
						<div class="portlet-body flip-scroll">
							<div style="text-align:right;">
								<a class="btn blue" id="xiuGaiAN"><i class="fa fa-search"></i>&nbsp;&nbsp;保存</a>
								<a class="btn default" onclick="window.close()"><i class="fa fa-search"></i>&nbsp;&nbsp;关闭</a>
							</div>
							<div class="row">
								<div class="col-md-6">
									<form class="form-horizontal" role="form">
										<div class="form-group">
											<label class="col-md-4 control-label">购买日期</label>
											<label class="col-md-8 control-label" style="text-align:left;"><fmt:formatDate value="${wuZi.gouMaiRQ }" pattern="yyyy-MM-dd"/></label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">资产编号</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.ziChanBH }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">物料编码</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.wuLiaoBM }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">使用部门</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.dep.depName }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">使用人</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.user.name }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">增加方式</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.zengJiaFS }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">入库日期</label>
											<label class="col-md-8 control-label" style="text-align:left;"><fmt:formatDate value="${wuZi.ruKuRQ }" pattern="yyyy-MM-dd"/></label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">开始使用日期</label>
											<label class="col-md-8 control-label" style="text-align:left;"><fmt:formatDate value="${wuZi.chuKuRQ }" pattern="yyyy-MM-dd"/></label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">使用状态</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.shiYongZT.zhangTaiMC }</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">物资类型</label>
											<label class="col-md-8 control-label" style="text-align:left;">
												<c:choose>
													<c:when test="${wuZi.wuZiLX==1 }">
														低值资产
													</c:when>
													<c:when test="${wuZi.wuZiLX==2 }">
														低值易耗品
													</c:when>
												</c:choose>
											</label>
										</div>
										<div class="form-group">
											<label class="col-md-4 control-label">物资类别</label>
											<label class="col-md-8 control-label" style="text-align:left;">${wuZi.wuZiLB.leibieMC }</label>
										</div>
									</form>
								</div>
								<div class="col-md-6">		
									<form class="form-horizontal" method="POST" action="">
									<div class="col-md-12">
										<div class="row">
											<div class="form-group">
												<label class="col-md-2 control-label">照片</label>
												<div class="col-md-10">
													<div id="myCarousel" class="carousel slide" style="width:300px; text-align:center;">
														<!-- Carousel items -->
														<div class="carousel-inner" id="tuPianList">
														</div>
														<!-- Carousel nav -->
														<a class="carousel-control left" href="#myCarousel" data-slide="prev">
															<i class="fa fa-angle-left"></i>
														</a>
														<a class="carousel-control right" href="#myCarousel" data-slide="next">
															<i class="fa fa-angle-right"></i>
														</a>										
													</div>
												</div>
											</div>
										</div>
										<div class="row">
											<div class="form-group">
												<div class="col-md-4"></div>
												<div class="col-md-8">
													<a class="btn green" data-toggle="modal" href="#uploadFJ" id="upTuPian">上传照片</a>
												</div>
												<br>
											</div>
										</div>	
									</div>
								</form>
								</div>
							</div>
							<form class="form-horizontal" method="POST" action="" id="wuZiForm" role="form">
								<input type="hidden" name="id" value="${wuZi.id }">
								<div class="col-md-12">
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">资产编码(财务)</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.ziChanBM }" name="ziChanBM" placeholder="资产编码">
											</div>
											<label class="col-md-2 control-label">管理部门</label>
											<div class="col-md-4">
												<select name="guanLiBMId" id="guanLiBMId" class="form-control">
													<option value="">请选择...</option>
													<c:forEach items="${depList }" var="u">
														<option value="${u.id }"><c:forEach var="item" varStatus="status" begin="1" end="${u.cengJi}">&nbsp;&nbsp;&nbsp;&nbsp;</c:forEach>${u.depName }</option>
													</c:forEach>
												</select>
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">物资名称</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.wuZiMC }" name="wuZiMC" placeholder="物资名称">
											</div>
											<label class="col-md-2 control-label">物资品牌</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.pinPai }" name="pinPai" placeholder="物资品牌">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">规格型号</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.guiGeXH }" name="guiGeXH" placeholder="规格型号">
											</div>

											<label class="col-md-2 control-label">产品序列号</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.chanPinXLH }" name="chanPinXLH" placeholder="产品序列号">
											</div>

										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">物资原值</label>
											<div class="col-md-2">
												<input type="text" class="form-control" value="${wuZi.wuZiYZ }" name="wuZiYZ" placeholder="物资原值">
											</div>
											<label class="col-md-2 control-label" style="text-align:left;">${wuZi.biZhong.biZhongMC }</label>
											
											<%--<label class="col-md-2 control-label">物资净值</label>
											<div class="col-md-4">
												<input type="text" class="form-control" value="${wuZi.wuZiJingZhi }" name="wuZiJingZhi" placeholder="物资净值">
											</div>--%>
										</div>
									</div>
									<%--<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">预计净残值率</label>											
											<div class="col-md-2">
												<input type="text" class="form-control" value="${wuZi.jingCanZhiLv }" name="jingCanZhiLv" placeholder="预计净残值率">
											</div>
											<label class="col-md-1 control-label" style="text-align:left;">%</label>
										</div>
									</div>--%>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">生产厂家</label>
											<div class="col-md-8">
												<input type="text" class="form-control" value="${wuZi.shengChanCJ }" name="shengChanCJ" placeholder="生产厂家">
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">供应商名称</label>
											<div class="col-md-8">
												<input type="text" class="form-control" value="${wuZi.gongYingShangMC }" name="gongYingShangMC" placeholder="供应商名称">
											</div>
										</div>
									</div>								

									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">保修截止日期</label>
											<div class="col-md-8">
												<div class="input-group input-medium date date-picker" data-date-format="yyyy-mm-dd">
													<input type="text" class="form-control" name="baoXiuJZRQStr" value="<fmt:formatDate value="${wuZi.baoXiuJZRQ }" pattern="yyyy-MM-dd"/>" readonly>
													<span class="input-group-btn">
													<button class="btn default" type="button"><i class="fa fa-calendar"></i></button>
													</span>
												</div>
											</div>
										</div>
									</div>
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">备注</label>
											<div class="col-md-8">
												<input type="text" class="form-control" value="${wuZi.beiZhu }" name="beiZhu" placeholder="备注">
											</div>
										</div>
									</div>					
									<div class="row">
										<div class="form-group">
											<label class="col-md-2 control-label">存放地点</label>
											<div class="col-md-8">
												<input type="text" class="form-control" value="${wuZi.cunFangD }" name="cunFangD" placeholder="存放地点">
											</div>
										</div>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>			
			<!-- END PAGE CONTENT-->
		</div>
		<!-- END PAGE -->
	</div>
	<!-- END CONTAINER -->
	<!-- BEGIN FOOTER -->
	<%@include file="../include/footer.jsp" %>
	<!-- END FOOTER -->
	<div class="modal fade" id="uploadFJ" tabindex="-1" role="basic" aria-hidden="true">
		<div class="modal-dialog modal-wide">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
					<h4 class="modal-title">上传文件</h4>
				</div>
				<div class="modal-body" id="fileUploadBody">
				</div>
				<div class="modal-footer">
					<button type="button" class="btn blue" data-dismiss="modal">关闭</button>
				</div>
			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<script id="template-upload" type="text/x-tmpl">
		{% for (var i=0, file; file=o.files[i]; i++) { %}
		    <tr class="template-upload fade">
		        <td>
		            <span class="preview"></span>
		        </td>
		        <td>
		            <p class="name">{%=file.name%}</p>
		            {% if (file.error) { %}
		                <div><span class="label label-danger">错误</span> {%=file.error%}</div>
		            {% } %}
		        </td>
		        <td>
		            <p class="size">{%=o.formatFileSize(file.size)%}</p>
		            {% if (!o.files.error) { %}
		                <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
		                <div class="progress-bar progress-bar-success" style="width:0%;"></div>
		                </div>
		            {% } %}
		        </td>
		        <td>
		            {% if (!o.files.error && !i && !o.options.autoUpload) { %}
		                <button class="btn blue start">
		                    <i class="fa fa-upload"></i>
		                    <span>上传</span>
		                </button>
		            {% } %}
		            {% if (!i) { %}
		                <button class="btn red cancel">
		                    <i class="fa fa-ban"></i>
		                    <span>取消</span>
		                </button>
		            {% } %}
		        </td>
		    </tr>
		{% } %}
	</script>
	<!-- The template to display files available for download -->
	<script id="template-download" type="text/x-tmpl">
		{% for (var i=0, file; file=o.files[i]; i++) { %}
		    <tr class="template-download fade">
		        <td>
		            <span class="preview">
		                {% if (file.thumbnailUrl) { %}
		                    <a href="${ctx}{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery>
		                    <img src="{%=file.fileIcon%}" style="width:32px;height:32px;">
		                    </a>
		                {% } %}
		            </span>
		        </td>
		        <td>
		            <p class="name">
		                {% if (file.url) { %}
		                    <a href="${ctx}{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" ${ctx}{%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
		                {% } else { %}
		                    <span>{%=file.name%}</span>
		                {% } %}
		            </p>
		            {% if (file.error) { %}
		                <div><span class="label label-danger">错误</span> {%=file.error%}</div>
		            {% } %}
		        </td>
		        <td>
		            <span class="size">{%=o.formatFileSize(file.size)%}</span>
		        </td>
		        <td>
		            {% if (file.deleteUrl) { %}
		                <button onclick="delFuJian('{%=file.fuJianId%}','{%=file.type%}')" class="btn red delete" data-type="{%=file.deleteType%}" data-url="${ctx}{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
		                    <i class="fa fa-trash-o"></i>
		                    <span>删除</span>
		                </button>
		            {% } else { %}
		                <button class="btn yellow cancel">
		                    <i class="fa fa-ban"></i>
		                    <span>取消</span>
		                </button>
		            {% } %}
		        </td>
		    </tr>
		{% } %}
	</script>
	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
	<!-- BEGIN CORE PLUGINS -->   
	<!--[if lt IE 9]>
	<script src="${ctx}/assets/plugins/respond.min.js"></script>
	<script src="${ctx}/assets/plugins/excanvas.min.js"></script> 
	<![endif]-->   
	<script src="${ctx}/assets/plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>    
	<script src="${ctx}/assets/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/bootstrap-hover-dropdown/twitter-bootstrap-hover-dropdown.min.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/jquery.blockui.min.js" type="text/javascript"></script>  
	<script src="${ctx}/assets/plugins/jquery.cookie.min.js" type="text/javascript"></script>
	<script src="${ctx}/assets/plugins/uniform/jquery.uniform.min.js" type="text/javascript" ></script>
	<script src="${ctx}/assets/scripts/form-components.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datepicker/js/locales/bootstrap-datepicker.zh-CN.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/clockface/js/clockface.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-daterangepicker/moment.min.js"></script>
	<script type="text/javascript" src="${ctx}/assets/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
	<script type="text/javascript" src="${ctx}/frontend/assets/plugins/revolution_slider/rs-plugin/js/jquery.themepunch.plugins.min.js"></script>
    <script type="text/javascript" src="${ctx}/frontend/assets/plugins/revolution_slider/rs-plugin/js/jquery.themepunch.revolution.min.js"></script> 
    <script type="text/javascript" src="${ctx}/frontend/assets/plugins/bxslider/jquery.bxslider.min.js"></script>    
    <script src="${ctx}/assets/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="${ctx }/assets/plugins/jquery.input-ip-address-control-1.0.min.js"></script>
    <script type="text/javascript" src="${ctx }/assets/plugins/jquery-multi-select/js/jquery.multi-select.js"></script>
    <script type="text/javascript" src="${ctx }/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js"></script>
    <script type="text/javascript" src="${ctx}/assets/plugins/select2/select2.min.js"></script>
    <script type="text/javascript" src="${ctx}/assets/plugins/fuelux/js/spinner.min.js"></script>
    <script src="${ctx}/assets/plugins/bootstrap-touchspin/bootstrap.touchspin.js" type="text/javascript"></script>
    <script src="${ctx }/assets/plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript" ></script>
    
    <script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/tmpl.min.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/load-image.min.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/vendor/canvas-to-blob.min.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.iframe-transport.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-process.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-image.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-audio.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-video.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-validate.js"></script>
	<script src="${ctx }/assets/plugins/jquery-file-upload/js/jquery.fileupload-ui.js"></script>
	
    <script src="${ctx}/frontend/assets/scripts/index.js"></script>
	<!-- END CORE PLUGINS -->
	<script src="${ctx}/assets/scripts/app.js"></script>
	
	<script src="${ctx }/js/form-fileupload.js"></script>	
	<script>
		var fileType=0;
		
		jQuery(document).ready(function() {       
		   // initiate layout and plugins
		   App.init();
		   FormComponents.init();		   
		   $('#guanLiBMId').attr('value','${wuZi.guanLiBM.id}');
		   fileType=0;
		   $.ajax({
				type:"POST",
				url:"${ctx}/wuzi/displayTuPian.do",
				dataType:"html",
				data:{
					"wuZiId":"${wuZi.id}"
				},
				success:function(data){											
					$('#tuPianList').html(data);
				}
			});
		});
		
		function validateForm() {
			//validate方法参数可选  
			return $("#wuZiForm").validate({
				errorElement: 'span', //default input error message container
	            errorClass: 'help-block', // default input error message class
	            focusInvalid: false, // do not focus the last invalid input
				rules : {
					wuZiYZ : {
						required : true,
						number : true
					},
					wuZiJingZhi : {
						required : true,
						number : true
					},
					zheJiuYX : {
						required : true,
						digits : true
					},
					baoFeiYX : {
						required : true,
						digits : true
					},
					zheJiuYS : {
						required : true,
						digits : true
					},
					jingCanZhiLv : {
						required : true,
						number : true
					}
				},
				messages : {
					wuZiYZ : {
						required : '请输入物资原值',
						number : '请输入数值'
					}
				},
				
				errorPlacement: function(error, element) {  
				    error.appendTo(element.parent());  
				}
			}).form();			
		}
		
		$('#xiuGaiAN').bind("click",function(){			
			if(validateForm()){
				$.ajax({
					type:"POST",
					data:$('#wuZiForm').serialize(),
					url:"${ctx}/wuzi/wuZiXiuGaiSave.do",
					dataType:"json",
					success:function(data){
						if(data.result=="success"){
							alert("物资内容已成功修改")
							window.opener.location.reload();
							window.close();
						}
					}
				});
			}
		});
		
		function displayFuJian(){
			$.ajax({
				type:"POST",
				url:"${ctx}/wuzi/displayFuJian.do",
				dataType:"html",
				data:{
					"fileType":1,
					"wuZiId":"${wuZi.id}"
				},
				success:function(data){
					$('#tuPianList').html(data);
				}
			});
		}
		
		$('#upTuPian').click(function(){
			$.ajax({
				type:"POST",
				url:"${ctx}/wuzi/uploadForm.do",
				data:{
					"wuZiId":"${wuZi.id}",
					"type":"1"
				},
				dataType:"html",
				async:false,
				success:function(data){
					$('#fileUploadBody').html(data);
					FormFileUpload.init();
				}
			});
		});
		
		function upFuJian(id,ysWJM,type){
			if(type=="1"){
				$.ajax({
					type:"POST",
					url:"${ctx}/wuzi/displayTuPian.do",
					dataType:"html",
					data:{
						"wuZiId":"${wuZi.id}"
					},
					success:function(data){
						$('#tuPianList').html(data);
					}
				});
			}
		}
		
		function delFuJian(id,type){
			$.ajax({
				type:"POST",
				url:"${ctx}/wuzi/delFuJian.do",
				dataType:"json",
				data:{
					"id":id,
					"type":"1"
				},
				success:function(data1){
					$.ajax({
						type:"POST",
						url:"${ctx}/wuzi/displayTuPian.do",
						dataType:"html",
						data:{
							"wuZiId":"${shenQing.wuZi.id}"
						},
						success:function(data){
							$('#tuPianList').html(data);
						}
					});
				}
			});
		}
		
		var shanChuTuPian=function(id){
			if(window.confirm('您确认删除该照片吗？')){
				$.ajax({
					type:"POST",
					url:"${ctx}/wuzi/delFuJian.do",
					dataType:"json",
					data:{
						"id":id,
						"type":"1"
					},
					success:function(data1){
						$.ajax({
							type:"POST",
							url:"${ctx}/wuzi/displayTuPian.do",
							dataType:"html",
							data:{
								"wuZiId":"${wuZi.id}"
							},
							success:function(data){
								$('#tuPianList').html(data);
							}
						});
					}
				});
			}
		}
		
		var shanChuGLPJ=function(id){
			$.ajax({
				type:"POST",
				data:{					
					'id':id
				},
				url:"${ctx}/wuzi/shanChuGLPJ.do",
				async:false,
				success:function(data){
					window.location.reload();
				}
			});
		}
		
		var shanChuGLZJ=function(id){
			$.ajax({
				type:"POST",
				data:{
					"cid":"${wuZi.id}"
				},
				url:"${ctx}/wuzi/shanChuGLZJ.do",
				async:false,
				success:function(data){
					window.location.reload();
				}
			});
		}
	</script>
</body>
<!-- END BODY -->
</html>